package com.fmatos.carcontrol.view;

import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import com.fmatos.carcontrol.R;

public class BluetoothPickerActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super
				.onCreate(savedInstanceState);
		setContentView(R.layout.activity_bluetooth_picker);
		if (savedInstanceState == null) {
			getFragmentManager()
					.beginTransaction()
					.add(R.id.container, new PlaceholderFragment())
					.commit();
		}
	}

	/**
	 * A placeholder fragment containing a simple view.
	 */
	public static class PlaceholderFragment extends Fragment {

		private BluetoothListAdapter adapter;

		public PlaceholderFragment() {}

		@Override
		public View onCreateView(LayoutInflater inflater, ViewGroup container,
				Bundle savedInstanceState) {
			View rootView = inflater
					.inflate(R.layout.fragment_bluetooth_picker, container, false);
			
			ListView list = (ListView)rootView.findViewById(R.id.listview);
			
			adapter = new BluetoothListAdapter(getActivity());
			list.setAdapter(adapter);
			
			return rootView;
		}
	}
}
